package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"goods/internal/config"
	"goods/internal/model"
)

type ServiceContext struct {
	Config config.Config
	Goods  model.GoodsModel
	//GoodsSku model.GoodsSkuModel
	Category model.CategoryModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := sqlx.NewMysql(c.Mysql.Datasource)
	return &ServiceContext{
		Config: c,
		Goods:  model.NewGoodsModel(conn),
		//GoodsSku: model.NewGoodsSkuModel(conn),
		Category: model.NewCategoryModel(conn),
	}
}
